# Generated by script version: 0.3 2010-10-19

# ---------- included from tlight.inc ----------
#****************************************************************************
# tlight.inc
#
# Project: SCT Application Example for LPC1800
#
# Description:
#   This include file is used for the SCT state machine code generator.
#----------------------------------------------------------------------------
# Software that is described herein is for illustrative purposes only
# which provides customers with programming information regarding the
# products. This software is supplied "AS IS" without any warranties.
# NXP Semiconductors assumes no responsibility or liability for the
# use of the software, conveys no license or title under any patent,
# copyright, or mask work right to the product. NXP Semiconductors
# reserves the right to make changes in the software without
# notification. NXP Semiconductors also make no representation or
# warranty that such application will be suitable for the specified
# use without further testing or modification.
#****************************************************************************

# Define the capabilities of the SCT block in LPC1800
STATES 32;
OUTPUTS 16;
INPUTS 8;
EVENTS 16;


# Assign input/output names to physical I/O numbers
ASSIGN INPUT CROSS 3;

ASSIGN OUTPUT GREEN 0;
ASSIGN OUTPUT YELLOW 1;
ASSIGN OUTPUT RED 2;
ASSIGN OUTPUT WALK 3;
ASSIGN OUTPUT DONTWALK 4;
# used internally
ASSIGN OUTPUT REQUEST 5;




# ---------- include end ----------

INPUT CROSS;

OUTPUT WALK LOW;
OUTPUT GREEN HIGH;
OUTPUT YELLOW LOW;
OUTPUT DONTWALK HIGH;
OUTPUT REQUEST LOW;
OUTPUT RED LOW;

MODE SPLIT;


MATCH_COND turn_yellow_on COMPARE L WITH {yellow_on_time};
MATCH_COND pedestrian_walk COMPARE L WITH {pedestrian_walk_time};
MATCH_COND turn_red_off COMPARE L WITH {red_off_time};
MATCH_COND turn_red_on COMPARE L WITH {red_on_time};
MATCH_COND pedestrian_stop COMPARE L WITH {pedestrian_stop_time};
MATCH_COND turn_yellow_off COMPARE L WITH {yellow_off_time};

DEFINE STATE LOW L_ENTRY;
DEFINE STATE LOW YELLOW_ON_State;
DEFINE STATE LOW WALK_State;
DEFINE STATE LOW GREEN_ON_state;
DEFINE STATE LOW RED_ON_State;

RESETSTATE LOW L_ENTRY;

DEFINE EVENT LOW trans25;
EVENT trans25 L_LIMIT;
EVENT trans25 CLEARS (GREEN);
EVENT trans25 SETS (YELLOW);
EVENT trans25 MATCH turn_yellow_on;
EVENT trans25 STATE (GREEN_ON_state);
EVENT trans25 JUMPS (YELLOW_ON_State);
DEFINE EVENT LOW trans24;
EVENT trans24 L_LIMIT;
EVENT trans24 MATCH INPUT (CROSS) RISE;
EVENT trans24 SETS (REQUEST);
EVENT trans24 STATE (L_ENTRY);
EVENT trans24 JUMPS (GREEN_ON_state);
DEFINE EVENT LOW trans42;
EVENT trans42 L_LIMIT;
EVENT trans42 SETS (WALK);
EVENT trans42 MATCH pedestrian_walk AND OUTPUT (REQUEST) HIGH;
EVENT trans42 CLEARS (DONTWALK);
EVENT trans42 STATE (RED_ON_State);
EVENT trans42 JUMPS (WALK_State);
DEFINE EVENT LOW trans26;
EVENT trans26 L_LIMIT;
EVENT trans26 CLEARS (YELLOW);
EVENT trans26 MATCH turn_red_on AND OUTPUT (REQUEST) HIGH;
EVENT trans26 SETS (RED);
EVENT trans26 STATE (YELLOW_ON_State);
EVENT trans26 JUMPS (RED_ON_State);
DEFINE EVENT LOW trans43;
EVENT trans43 L_LIMIT;
EVENT trans43 CLEARS (WALK);
EVENT trans43 MATCH pedestrian_stop;
EVENT trans43 SETS (DONTWALK);
EVENT trans43 CLEARS (REQUEST);
EVENT trans43 STATE (WALK_State);
EVENT trans43 JUMPS (RED_ON_State);
DEFINE EVENT LOW trans30;
EVENT trans30 L_LIMIT;
EVENT trans30 SETS (GREEN);
EVENT trans30 CLEARS (YELLOW);
EVENT trans30 MATCH turn_yellow_off AND OUTPUT (REQUEST) LOW;
EVENT trans30 STATE (YELLOW_ON_State);
EVENT trans30 JUMPS (L_ENTRY);
DEFINE EVENT LOW trans31;
EVENT trans31 L_LIMIT;
EVENT trans31 SETS (YELLOW);
EVENT trans31 MATCH turn_red_off AND OUTPUT (REQUEST) LOW;
EVENT trans31 CLEARS (RED);
EVENT trans31 STATE (RED_ON_State);
EVENT trans31 JUMPS (YELLOW_ON_State);

